﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OverStore.TutorialAsTest.UnitTest.Configuration.Mocks;
using OverStore.Configuration.Components;

namespace OverStore.TutorialAsTest.UnitTest.Components.ObjectDepot
{
    /// <summary>
    /// Summary description for ObjectDepotTest
    /// </summary>
    [TestClass]
    public class ObjectDepotTest
    {        
        [TestMethod]
        public void ObjectDepot_GetId()
        {
            var activator = Component.Depot
                                     .WithInternalKey<ActivatedTestClass, int>(i => i.Id, () => new ActivatedTestClass())
                                     .CreateComponent(new MockContext());

            var instance = new ActivatedTestClass()
            {
                Id = 2
            };

            var getId = activator.GetObjectIdentifier(instance);
            Assert.AreEqual(instance.Id, getId);
        }

    }
}
